/*
 * @Author: funlee
 * @Email: i@funlee.cn
 * @Date: 2018-05-13 21:44:21
 * @Description: 内部迭代器 -- 判断两个数组里的元素的值是否完全相等 
 */
const each = function (arr, callback) {
  for (var i = 0; i < arr.length; i++) {
    callback.call(arr[i], i, arr[i])
  }
 }

var compare = function(ary1, ary2) {
  if(ary1.length !== ary2.length) {
    throw new Error('不相等')
  }
  each(ary1, function(i, n) {
    if(n !== ary2[i]) {
      throw new Error('不相等')
    }
  })
  console.log('相等')
}

compare([1,2,3],[1,2,3])
